package com.fcscs.cservice.domain.validator;

import com.fcscs.core.common.ErrorEnums;
import com.fcscs.core.common.FieldValidators;
import com.fcscs.core.domain.validator.BaseValidator;
import com.fcscs.cservice.domain.ContactInfo;
import com.fcscs.cservice.domain.GuestProfile;

public interface GuestProfileValidators {

	public static class GuestProfileValidator  extends BaseValidator<GuestProfile> {
		public ErrorEnums validate(GuestProfile entity, boolean newInstance) {
			ErrorEnums err = super.validate(entity, newInstance);
			if (err != null) {
				return err;
			} else {
				if (FieldValidators.isNullEmptyStr(entity.getFirstName()) || FieldValidators.isNullEmptyStr(entity.getLastName())
						|| entity.getGenderMale() == null || FieldValidators.isNullEmptyStr(entity.getEmail())
						|| FieldValidators.isNullEmptyStr(entity.getMobile())) {
					return ErrorEnums.GeneralError.REQURIED_FLD_MISSING;
				}
			}
			return null;
		}
	}

	public static class ContactInfoValidator  extends BaseValidator<ContactInfo> {
		public ErrorEnums validate(ContactInfo entity, boolean newInstance) {
			ErrorEnums err = super.validate(entity, newInstance);
			if (err != null) {
				return err;
			} else {
				if (entity.getTypeEnum() == null || entity.getPmsTypeEnum() == null) {
					return ErrorEnums.GeneralError.REQURIED_FLD_MISSING;
				}
			}
			return null;
		}
	}
}
